//
//  B_ZLBottomCell.m
//  Estate
//
//  Created by heyong on 16/6/12.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "B_ZLBottomCell.h"

@implementation B_ZLBottomCell

- (void)setIsEdit:(BOOL)isEdit{
    if(isEdit){
        self.text.userInteractionEnabled=YES;
    }else{
        self.text.userInteractionEnabled=NO;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle=UITableViewCellSelectionStyleNone;
    self.title.font=[UIFont systemFontOfSize:16*BIZ];
    self.text.delegate=self;
     self.title.textColor=UIColorFromRGB(0x797979);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)textChanged:(UITextField *)sender {
    if(self.textChangeBlock){
        self.textChangeBlock(self.text.text);
    }
}

- (IBAction)textBegin:(UITextField *)sender {
    
}

- (IBAction)textEnd:(UITextField *)sender {
    
}

#pragma mark UITextFieldDelegate
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [_text resignFirstResponder];
    
    return  YES;
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    //   限制苹果系统输入法  禁止输入表情
    if ([[[UITextInputMode currentInputMode]primaryLanguage] isEqualToString:@"emoji"]) {
        return NO;
    }
 
    return YES;
}
//设置分割线
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect);
    //上分割线，
    CGContextSetStrokeColorWithColor(context,[UIColor colorWithRed:0.89 green:0.89 blue:0.90 alpha:1.00].CGColor); CGContextStrokeRect(context, CGRectMake(0, -1, rect.size.width , 1));
    //下分割线
    CGContextSetStrokeColorWithColor(context,[UIColor colorWithRed:0.89 green:0.89 blue:0.90 alpha:1.00].CGColor);
    CGContextStrokeRect(context, CGRectMake(0, rect.size.height+1, rect.size.width, 1));
}
@end
